<?php

    class PoUtil{
        public static function received(PoLedger $ledger,$adjust,$warehouse){
            $act = new Inventoryact();
            $poModel = $ledger->poModel;
            $act->qty = $adjust;
            $act->partno = $ledger->partno;
            $act->ponum = $ledger->pono;
            $act->warehouse = $warehouse;
            $act->reason = 'Purchase';
            $act->source = 'P';
            $act->period = date('Ym');
            $act->partdesc = $ledger->description;
            $act->description = "Purchase";
            $act->recby = Yii::app()->user->model->employeeid;
            $act->job = $ledger->jobno;
            $act->date = date('Y-m-d');
            $act->time = date('H:i:s');
            $act->type = 'I';
            $act->cost = $ledger->price;
            $act->department = $ledger->deptid;
            $act->dispatch = $ledger->dispatchno;
            $act->vendorno =  $poModel->vendor;
            if($act->save())
            {               
                return true;
            }            
            return false;
        }
    }
?>
